﻿// AUTOMATICALLY GENERATED CODE

using System;
using System.Collections.Generic;
using Sce.PlayStation.Core;
using Sce.PlayStation.Core.Imaging;
using Sce.PlayStation.Core.Environment;
using Sce.PlayStation.HighLevel.UI;

namespace Nyanimals_UI
{
    partial class MainMenu
    {
        Button Button_World;
        Button Button_Race;
        Button Button_Exit;
        Label Label_1;

        private void InitializeWidget()
        {
            InitializeWidget(LayoutOrientation.Horizontal);
        }

        private void InitializeWidget(LayoutOrientation orientation)
        {
            Button_World = new Button();
            Button_World.Name = "Button_World";
            Button_Race = new Button();
            Button_Race.Name = "Button_Race";
            Button_Exit = new Button();
            Button_Exit.Name = "Button_Exit";
            Label_1 = new Label();
            Label_1.Name = "Label_1";

            // Button_World
            Button_World.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            Button_World.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular);

            // Button_Race
            Button_Race.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            Button_Race.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular);

            // Button_Exit
            Button_Exit.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            Button_Exit.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular);

            // Label_1
            Label_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Label_1.Font = new UIFont(FontAlias.System, 48, FontStyle.Bold);
            Label_1.LineBreak = LineBreak.Character;
            Label_1.HorizontalAlignment = HorizontalAlignment.Center;

            // MainMenu
            this.RootWidget.AddChildLast(Button_World);
            this.RootWidget.AddChildLast(Button_Race);
            this.RootWidget.AddChildLast(Button_Exit);
            this.RootWidget.AddChildLast(Label_1);
            this.Showing += new EventHandler(onShowing);
            this.Shown += new EventHandler(onShown);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }

        private LayoutOrientation _currentLayoutOrientation;
        public void SetWidgetLayout(LayoutOrientation orientation)
        {
            switch (orientation)
            {
                case LayoutOrientation.Vertical:
                    this.DesignWidth = 544;
                    this.DesignHeight = 960;

                    Button_World.SetPosition(363, 152);
                    Button_World.SetSize(214, 56);
                    Button_World.Anchors = Anchors.None;
                    Button_World.Visible = true;

                    Button_Race.SetPosition(363, 265);
                    Button_Race.SetSize(214, 56);
                    Button_Race.Anchors = Anchors.None;
                    Button_Race.Visible = true;

                    Button_Exit.SetPosition(363, 378);
                    Button_Exit.SetSize(214, 56);
                    Button_Exit.Anchors = Anchors.None;
                    Button_Exit.Visible = true;

                    Label_1.SetPosition(274, 51);
                    Label_1.SetSize(214, 36);
                    Label_1.Anchors = Anchors.None;
                    Label_1.Visible = true;

                    break;

                default:
                    this.DesignWidth = 960;
                    this.DesignHeight = 544;

                    Button_World.SetPosition(373, 184);
                    Button_World.SetSize(214, 56);
                    Button_World.Anchors = Anchors.None;
                    Button_World.Visible = true;

                    Button_Race.SetPosition(373, 303);
                    Button_Race.SetSize(214, 56);
                    Button_Race.Anchors = Anchors.None;
                    Button_Race.Visible = true;

                    Button_Exit.SetPosition(373, 422);
                    Button_Exit.SetSize(214, 56);
                    Button_Exit.Anchors = Anchors.None;
                    Button_Exit.Visible = true;

                    Label_1.SetPosition(322, 64);
                    Label_1.SetSize(315, 57);
                    Label_1.Anchors = Anchors.None;
                    Label_1.Visible = true;

                    break;
            }
            _currentLayoutOrientation = orientation;
        }

        public void UpdateLanguage()
        {
            Button_World.Text = "World";

            Button_Race.Text = "Race";

            Button_Exit.Text = "Exit";

            Label_1.Text = "NYANIMALS";

            this.Title = "Nyanimals Main Menu";
        }

        private void onShowing(object sender, EventArgs e)
        {
            switch (_currentLayoutOrientation)
            {
                case LayoutOrientation.Vertical:
                    Label_1.Visible = false;
                    break;

                default:
                    Label_1.Visible = false;
                    break;
            }
        }

        private void onShown(object sender, EventArgs e)
        {
            switch (_currentLayoutOrientation)
            {
                case LayoutOrientation.Vertical:
                    new BunjeeJumpEffect()
                    {
                        Widget = Label_1,
                    }.Start();
                    break;

                default:
                    new BunjeeJumpEffect()
                    {
                        Widget = Label_1,
                    }.Start();
                    break;
            }
        }

    }
}
